//
//  AlbumDetailsInformationCell.m
//  SuperRadio
//
//  Created by GYRu on 14-12-21.
//  Copyright (c) 2014年 三个臭皮匠. All rights reserved.
//

#import "AlbumDetailsInformationCell.h"

#import "Introduction.h"

@interface AlbumDetailsInformationCell ()

// 专辑
@property (nonatomic, retain) UILabel *albumDetailsTittleShow;
// 显示专辑名称
@property (nonatomic, retain) UILabel *albumDetailsTittle;
// 创建人
@property (nonatomic, retain) UILabel *albumDetailsNicknameShow;
// 显示创建人
@property (nonatomic, retain) UILabel *albumDetailsNickname;
// 标签
@property (nonatomic, retain) UILabel *albumDetailsTagsShow;
// 显示专辑名称
@property (nonatomic, retain) UILabel *albumDetailsTags;
// 简介
@property (nonatomic, retain) UILabel *albumDetailsIntroShow;
// 显示专辑名称
@property (nonatomic, retain) UILabel *albumDetailsIntro;


@end

@implementation AlbumDetailsInformationCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
       
        // 专辑
        _albumDetailsTittleShow = [[UILabel alloc] init];
        [self.contentView addSubview:_albumDetailsTittleShow];
        _albumDetailsTittleShow.font = [UIFont systemFontOfSize:14];
        [_albumDetailsTittleShow release];

        
        // 显示专辑名称
        _albumDetailsTittle = [[UILabel alloc] init];
        [self.contentView addSubview:_albumDetailsTittle];
        _albumDetailsTittle.font = [UIFont systemFontOfSize:14];
        [_albumDetailsTittle release];
        _albumDetailsTittle.numberOfLines = 0;
        // 创建人
        _albumDetailsNicknameShow = [[UILabel alloc]init];
        [self.contentView addSubview:_albumDetailsNicknameShow];
        _albumDetailsNicknameShow.font = [UIFont systemFontOfSize:14];
        [_albumDetailsNicknameShow release];

        // 显示创建人
        _albumDetailsNickname = [[UILabel alloc] init];
        [self.contentView addSubview:_albumDetailsNickname];
        _albumDetailsNickname.font = [UIFont systemFontOfSize:14];
        [_albumDetailsNickname release];
        _albumDetailsNickname.numberOfLines = 0;
        // 标签
        _albumDetailsTagsShow = [[UILabel alloc] init];
        [self.contentView addSubview:_albumDetailsTagsShow];
        _albumDetailsTagsShow.font = [UIFont systemFontOfSize:14];
        [_albumDetailsTagsShow  release];
        
        // 显示专辑名称
        _albumDetailsTags = [[UILabel alloc] init];
        [self.contentView addSubview:_albumDetailsTags];
        _albumDetailsTags.font = [UIFont systemFontOfSize:14];
        [_albumDetailsTags release];
        _albumDetailsTags.numberOfLines = 0;
        // 简介
        _albumDetailsIntroShow = [[UILabel alloc] init];
        [self.contentView addSubview:_albumDetailsIntroShow];
        _albumDetailsIntroShow.font = [UIFont systemFontOfSize:14];
        [_albumDetailsIntroShow release];

        // 显示专辑简介
        _albumDetailsIntro = [[UILabel alloc] init];
        [self.contentView addSubview:_albumDetailsIntro];
        _albumDetailsIntro.font = [UIFont systemFontOfSize:14];
        [_albumDetailsIntro release];
        _albumDetailsIntro.numberOfLines = 0;
        
    }
    
    return self;
}


// 重写setter方法

- (void)setIntroduction:(Introduction *)introduction
{
    if (_introduction != introduction) {
        [_introduction release];
        _introduction = [introduction retain];
    }
    
    _albumDetailsTittleShow.text = @"名称:";
    _albumDetailsTittle.text = _introduction.title;

    _albumDetailsNicknameShow.text = @"播主:";
    _albumDetailsNickname.text = _introduction.nickname;
   
    _albumDetailsTagsShow.text = @"标签:";
    _albumDetailsTags.text = _introduction.tags;
    
    _albumDetailsIntroShow.text = @"简介:";
    _albumDetailsIntro.text = _introduction.intro;
    

}

// 布局
- (void)layoutSubviews {
    [super layoutSubviews];
    CGFloat width = self.frame.size.width;
    //CGFloat height = self.frame.size.height;

    // 前面的起始
    CGFloat frontX = 20;
    // 前面的每个宽
    CGFloat frontWidth = 40;
    // 后面的起始X
    CGFloat front = frontWidth + frontX;
    // 每个高
    CGFloat perHeight = 20;
    // 专辑
    _albumDetailsTittleShow.frame = CGRectMake(frontX, 10, frontWidth, perHeight);
    // 显示专辑名称
    _albumDetailsTittle.frame = CGRectMake(front, 10, width - front - frontX, perHeight);
    // 创建人
    _albumDetailsNicknameShow.frame = CGRectMake(frontX, 50, frontWidth, perHeight);
    // 显示创建人
    _albumDetailsNickname.frame = CGRectMake(front, 50, width - front - frontX, perHeight);
    // 标签
    _albumDetailsTagsShow.frame = CGRectMake(frontX, 90, frontWidth, perHeight);
    // 显示专辑名称
    _albumDetailsTags.frame = CGRectMake(front, 90, width - front - frontX, perHeight);
   // 简介
     _albumDetailsIntroShow.frame = CGRectMake(frontX, 130, frontWidth, perHeight);
    // 显示专辑名称
     _albumDetailsIntro.frame = CGRectMake(front, 130, width - front - frontX, perHeight);;
    
    [_albumDetailsTittle sizeToFit];
    [_albumDetailsNickname sizeToFit];
    [_albumDetailsTags sizeToFit];
    [_albumDetailsIntro sizeToFit];
    self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, width, _albumDetailsIntro.frame.origin.y + _albumDetailsIntro.frame.size.height);
}


// 释放
- (void)dealloc
{
    // 专辑
    [_albumDetailsTittleShow release];
    // 显示专辑名称
    [_albumDetailsTittle release];
    // 创建人
    [_albumDetailsNicknameShow release];
    // 显示创建人
    [_albumDetailsNickname release];
    // 标签
    [_albumDetailsTagsShow release];
    // 显示专辑名称
    [_albumDetailsTags release];
    // 简介
    [_albumDetailsIntroShow release];
    // 显示专辑名称
    [_albumDetailsIntro release];
    [super dealloc];
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
